﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WmsApp.WindowControl.PriceAndAmount
{
    /// <summary>
    /// 算法的简单工厂实现
    /// </summary>
    public class ArithFactory
    {
        /// <summary>
        /// 工厂方法，产生算法对象
        /// </summary>
        /// <param name="inclTax">是否含税</param>
        /// <param name="taxRate">税率</param>
        /// <param name="price">单价，如果含税，则是含税单价，如果不含税，则是不含税单价</param>
        /// <param name="quantity">数量</param>
        /// <returns>算法基类对象</returns>
        public static PriceAndAmountArithBase CreatePriceAndAmountArith(bool inclTax,decimal taxRate, decimal price, decimal quantity)
        {
            if(inclTax)
            {
                return new PriceAndAmountArithTax(taxRate, price, quantity);
            }
            else
            {
                return new PriceAndAmountArithNotTax(taxRate, price, quantity);
            }
        }
    }
}
